package cn.edu.bupt.scidata.mapper;

import cn.edu.bupt.scidata.model.paper.News;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface newsmapper {
    //    根据两学科查询资讯列表
    @Select("SELECT news.url, DATE_FORMAT( date, \"%Y-%m-%d\" ) AS date, news.title FROM news WHERE id in ( SELECT b.news_id  FROM news_clf b INNER JOIN news_clf a ON a.news_id = b.news_id AND a.classify_id = #{a_id} AND b.classify_id = #{b_id} ) ")
//    @Select("SELECT * FROM news WHERE id IN (SELECT a.news_id FROM news_clf a left JOIN news_clf b ON a.news_id = b.news_id WHERE a.classify_id = #{a_id} AND b.classify_id = #{b_id})")
    List<News> querynews(int a_id, int b_id);
}
